<?php

require_once('Log/mail.php');

class FRM_Log_Mail extends Log_mail
{
	function close()
	{
		if ($this->_opened)
		{
			if ($this->_shouldSend && !empty($this->_message))
			{
				// Use NetBiz mail
				$mail = FRM_Mail::create();
				$mail->setSender('log@'.str_replace('http://','',APPLICATION_URL));
				$mail->addRecipient($this->_recipients);
				$mail->setSubject($this->_subject);
				$mail->setText($this->_message);
				if (!$mail->send())
				{
					return FALSE;
				}
	
				/* Clear the message string now that the email has been sent. */
				$this->_message = '';
				$this->_shouldSend = false;
			}
			$this->_opened = false;
		}
	
		return TRUE;
	}
}